Hi Tom, I'm having a problem with the program locking up. I figured out what is causing it, but don't know the proper way to solve it. My spindleOnCW.c file does three things, it first checks my switch probe bit to see if it is not active ,(not active means it is plugged in). If this is the case, then I use the MsgBox command to bring up the window warning as such and the spindle is not turned on. If the probe is not hooked up, I set my pwm output to enabled. I then delay a set number of seconds based upon the spindle speed before exiting the code. This allows the spindle to get up to speed before any motion occurs. I have at the end of my file:
double nowTime = Time_sec(); while((Time_sec() - nowTime) < delayTime) { WaitNextTimeSlice(); }
In KMotionCNC, I have to setup for my M3 definition as Execute and Wait. (Simply using Execute doesn't appear to create the delay I want). This seems to work well, however if my probe is plugged in we get into a race condition and the GCodeInterpreter gets stuck in a loop waiting for a non "0" response from a WriteLineReadLine("CheckThread command. So on one hand, the .c file is in a loop waiting on a signal from KMotionCNC that the MsgBox command has finished, and the GCodeInterpreter is also in a loop waiting for the thread to finish. The GCodeInterpreter loop is preventing the KMotionCNC code from responding to the message to bring up the MessageBox. Any insight on how to handle this better? Eric
|